home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Champak 66
/
Vol 66.iso
/
games
/
bob_espo.swf
/
scripts
/
__Packages
/
EndScreen.as
< prev
next >
Wrap
Text File
|
2013-04-24
|
4KB
|
102 lines
class EndScreen extends State
{
static var sSTATE_IN = "In";
static var sSTATE_IDLE = "Idle";
static var sSTATE_OUT = "Out";
static var nFIRST_VISIBLE_FRAME = 15;
function EndScreen(_mcRef)
{
super(_mcRef);
this.setState(EndScreen.sSTATE_IN);
this.bRestartButton = false;
this.nFinalScore = CTRLGame.getRef().Score;
this.sUnit = " points!";
if(this.nFinalScore == 0 || this.nFinalScore == 1)
{
this.sUnit = " point!";
}
}
function doPause()
{
}
function doUnPause()
{
}
function In()
{
this.mcRef.mcState.mcScreen.txtScore.text = Utils.styleNumber(this.nFinalScore) + this.sUnit;
if(this.stateFinished())
{
this.setState(EndScreen.sSTATE_IDLE);
this.initScreen();
this.mcRef.mcState.txtScore.text = Utils.styleNumber(this.nFinalScore) + this.sUnit;
}
else if(this.mcRef.mcState._currentframe == EndScreen.nFIRST_VISIBLE_FRAME)
{
Main.getRef().showHighScoreStuff(this.mcRef.mcState.mcScreen.mcSubmit);
this.mcRef.mcState.mcScreen.txtScore.text = Utils.styleNumber(this.nFinalScore) + this.sUnit;
if(Main.getRef().sState == Main.sSTATE_WIN)
{
Controller.getRef().getSounds().playSound("WinScreen_In",Controller.nSFX_VOLUME,1);
}
else if(Main.getRef().sState == Main.sSTATE_LOSE)
{
Controller.getRef().getSounds().playSound("LoseScreen_In",Controller.nSFX_VOLUME,1);
}
}
}
function Idle()
{
}
function Out()
{
this.mcRef.mcState.mcScreen.txtScore.text = Utils.styleNumber(this.nFinalScore) + this.sUnit;
if(this.stateFinished())
{
this.mcRef.mcState.stop();
if(this.bRestartButton)
{
Main.getRef().onRestartButton();
}
else
{
Main.getRef().onHighScoresButton();
}
}
}
function clickRestartButton()
{
Controller.getRef().playClickSound();
this.bRestartButton = true;
this.setOut();
}
function clickHighScoresButton()
{
Controller.getRef().playClickSound();
this.bRestartButton = false;
this.setOut();
}
function setOut()
{
this.setState(EndScreen.sSTATE_OUT);
Main.getRef().showHighScoreStuff(this.mcRef.mcState.mcScreen.mcSubmit);
Controller.getRef().getSounds().startFadeOut("WinScreen_In");
Controller.getRef().getSounds().startFadeOut("LoseScreen_In");
Controller.getRef().getSounds().playSound("EndScreen_Out",Controller.nSFX_VOLUME,1);
this.mcRef.mcState.mcScreen.txtScore.text = Utils.styleNumber(this.nFinalScore) + this.sUnit;
}
function initScreen()
{
this.mcRef.mcState.btnPlayAgain.onRollOver = Delegate.create(Main.getRef(),Main.getRef().rollOverButton);
this.mcRef.mcState.btnPlayAgain.onRelease = Delegate.create(this,this.clickRestartButton);
this.mcRef.mcState.btnHighScores.onRollOver = Delegate.create(Main.getRef(),Main.getRef().rollOverButton);
this.mcRef.mcState.btnHighScores.onRelease = Delegate.create(this,this.clickHighScoresButton);
Main.getRef().showHighScoreStuff(this.mcRef.mcState.mcSubmit);
if(this.mcRef.mcState.mcSubmit._visible)
{
this.mcRef.mcState.mcSubmit.btnSubmit.onRollOver = Delegate.create(Main.getRef(),Main.getRef().rollOverButton);
this.mcRef.mcState.mcSubmit.btnSubmit.onRelease = Delegate.create(Main.getRef(),Main.getRef().clickSubmitScore);
}
}
}